package top.continew.admin.controller.system;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.system.model.query.UserQuery;
import top.continew.admin.system.model.resp.user.UserDetailResp;
import top.continew.admin.system.model.resp.user.UserResp;
import top.continew.admin.system.service.UserService;
import top.continew.starter.extension.crud.model.resp.BasePageResp;
import top.continew.starter.web.model.R;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: examstar-manger-api
 * @description: 按平台的分销部门进行用户加载
 * @author: Xiong weiqiang
 * @create: 2025-05-28 11:03
 */
@Tag(name = "按平台的分销部门进行用户加载扩展API")
@RestController
@RequestMapping("/distributeDept")
public class DistributeDeptUserController {
    @Autowired
    private UserService userService;
    @RequestMapping("listUser")
    public R<BasePageResp<UserResp>> listUser(DistributeDeptUserPageQuery query) {
        Page<UserDetailResp> page = new Page<>(query.getPage(), query.getSize());
        UserQuery userQuery=new UserQuery();
        BeanUtil.copyProperties(query,userQuery);
        BasePageResp<UserResp> result=userService.listUserByDistributeDept(page, userQuery);
        return R.ok(result);
    }
}